/*--------------------------------------------------------------------------------*/
#ifndef __GRAPHIC_2D_OBJECT__
#define __GRAPHIC_2D_OBJECT__
/*--------------------------------------------------------------------------------*/
#include "primitives.h"
#include "array.h"
#include "object.h"
#include "math_vector_2.h"
#include "timer.h"
#include "color.h"
/*--------------------------------------------------------------------------------*/
class GRAPHIC_2D_OBJECT : public OBJECT
{

public:

    DECLARE_REF( GRAPHIC_2D_OBJECT );

    // .. TYPES

    struct VERTEX
    {
        MATH_VECTOR_2
			Position,
			UV;
    };

    // .. CONSTRUCTORS

    GRAPHIC_2D_OBJECT()
      : OBJECT(), VertexTable(), Position( MATH_VECTOR_2::Zero ), Extent( MATH_VECTOR_2::Zero ), Angle( 0.0f ), Color( COLOR::ColorWhite )
    {

    }

    // .. METHODS

    ARRAY<VERTEX> & GetVertexTable()
    {
        return VertexTable;
    }

    const ARRAY<VERTEX> & GetVertexTable() const
    {
        return VertexTable;
    }

    VOID SetPosition( const MATH_VECTOR_2 & position )
    {
    	Position = position;
    }

    const MATH_VECTOR_2 & GetPosition() const
    {
    	return Position;
    }

    VOID SetExtent( const MATH_VECTOR_2 & extent )
    {
    	Extent = extent;
    }

    const MATH_VECTOR_2 & GetExtent() const
    {
    	return Extent;
    }

    VOID SetAngle( const REAL & angle )
    {
    	Angle = angle;
    }

    const REAL & GetAngle() const
    {
    	return Angle;
    }
    
    VOID SetColor( const COLOR & color )
    {
    	Color = color;
    }

    const COLOR & GetColor() const
    {
    	return Color;
    }
    
    VOID AddVertex( const MATH_VECTOR_2 & position, const MATH_VECTOR_2 & uv )
    {
        VERTEX vertex;
        vertex.Position = position;
        vertex.UV = uv;
        VertexTable.Add( vertex );
    }

    virtual VOID ComputeVertexTable()
    {

    }

    virtual VOID Update( const TIMER & /*time_step*/ )
    {

    }

    virtual VOID Render()
    {

    }

    // -- PROTECTED

protected :

    // .. ATTRIBUTES

    ARRAY<VERTEX>
		VertexTable;
    MATH_VECTOR_2
		Position,
		Extent;
    REAL
		Angle;
	COLOR
		Color;


};
/*--------------------------------------------------------------------------------*/
#endif
